package com.ilxqx.framework.system.strategy.search;

import org.springframework.lang.NonNull;

import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.Path;
import javax.persistence.criteria.Predicate;

/**
 * 相等条件策略
 * @author venus
 */
public class EqualConditionStrategy implements ConditionStrategy {

    /**
     * 处理条件构建
     *
     * @param value   被比较值
     * @param path    比较路径（属性）
     * @param builder 条件构建器
     * @return 断言
     */
    @Override
    @NonNull
    public Predicate handle(Object value, Path path, CriteriaBuilder builder) {
        return builder.equal(path, value);
    }

}
